package com.qlm.job;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;



















import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.qlm.tongji.service.ISummaryService;
import com.qlm.tongji.service.impl.SummaryServiceImpl;
import com.qlm.tools.DateUtils;


public class MyJob extends Controller implements Job {
	
	private static final Logger logger = LoggerFactory.getLogger(MyJob.class);
	private ISummaryService summaryService = enhance(SummaryServiceImpl.class);


	@Override
	public void execute(JobExecutionContext jobExecutionContext)
			throws JobExecutionException {
		logger.info("定时统计执行..." + System.currentTimeMillis());
		updDayCount();
		summaryService.addSummary();
	}

	/**
	 * 定时将t_user表中day_count,is_sign字段清零
	 */
	public static void updDayCount(){
		String sql = "update t_user set day_count=0,is_sign=0";
		Db.update(sql);
		logger.info(DateUtils.getStringFullDate()+" 清零day_count,清零is_sign");
	}

}
